#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 105;

int n, m, k;
int dp[N][N];
void init(int n, int m, int k) {
  dp[0][0] = 0;
  rep(i, 1, m) dp[0][i] = dp[0][i - 1] ^ 1;
  rep(i, 1, n) dp[i][0] = dp[i - 1][0] ^ 1;
  rep(i, 1, n) rep(j, 1, m) {
    dp[i][j] = 0;
    if (i == k + 1 && j == k + 1) {
      int x = i;
    }
    if (!dp[i - 1][j]) dp[i][j] = 1;
    if (!dp[i][j - 1]) dp[i][j] = 1;
    if (i >= k && j >= k && !dp[i - k][j - k]) dp[i][j] = 1;
  }
  rep(i, 0, n) rep(j, 0, m) cout << dp[i][j] << " \n"[j == m];
}

void solve() {
  cin >> n >> m;
  int ans;
  if (k == 1) {
    ans = n % 2 == 0 || m % 2 == 0;
  } else {
    int x = min(n / (k + 1), m / (k + 1));
    if (n == x * (k + 1) || m == x * (k + 1))
      ans = 1;
    else {
      ans = ((n + m) & 1) != (x & 1);
    }
  }
  cout << "-+"[ans] << endl;
  return;
}
int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t >> k;
  while (t--) solve();
  return 0;
}